<html lang="en">
    <head></head>
    <body>
        <div id='textField'>Hello World</div>
        <br />
        <button id="clickHere" onclick="window.location.reload();">click here</button>

        <script>
            const queryString = window.location.search;
            const urlParams = new URLSearchParams(queryString);
            const dialogType = urlParams.get('dialogType');
            const div = document.getElementById('textField');

            switch(dialogType) {
                case "alert":
                    alert("Click accept");
                    div.textContent = 'alert dismissed';
                    break;
                case "confirm":
                    confirm("Click accept");
                    div.textContent = 'confirm dismissed';
                    break;
                case "prompt":
                    prompt("Add text and then click accept");
                    div.textContent = 'prompt dismissed';
                    break;
                case "beforeunload":
                    window.addEventListener('beforeunload', (event) => {
                        event.returnValue = "Are you sure you want to leave?";
                    });
                    div.textContent = 'beforeunload dismissed';
                    break;
            }
        </script>
    </body>
</html>